import axios, {AxiosInstance} from 'axios';

const devUrl = 'http://localhost:8095';
const proUrl = '/';
// const proUrl = 'http://210.21.12.168:8095';


export const BASE_URL: string = process.env.NODE_ENV === 'development' ? devUrl : proUrl;

const instance = axios.create({
   baseURL: BASE_URL
});
instance.interceptors.request.use((config: any) => {
   return config;
}, (error: any) => {
   return error;
});
instance.interceptors.response.use((res: { data: any }) => {
   return res.data;
}, (error: any) => {
   return Promise.reject(error);
});

export default instance as AxiosInstance;
